package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class WriteStringDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("fos.txt",true);
        /* String line = "亚古兽超进化！";
        *
        * 英文，数字，符号每个字符占1个字节
        * 中文每个字符占3哥字节
        * String提供：getBytes()字符串转字节
        *

        byte[] data = line.getBytes(StandardCharsets.UTF_8);
        fos.write(data);

        line = "奥米加兽！";
        fos.write(line.getBytes(StandardCharsets.UTF_8));

        line = "出发！救出我的所爱！";
        fos.write(line.getBytes(StandardCharsets.UTF_8));*/

        fos.write("我想我会开始想念你".getBytes(StandardCharsets.UTF_8));
        fos.write("，可是我刚刚才遇见了你".getBytes(StandardCharsets.UTF_8));
        System.out.println("写出完毕");
        fos.close();
    }
}
